package com.sunday.volunteer.http;


import com.sunday.common.model.ResultDO;
import com.sunday.volunteer.entity.Activity;
import com.sunday.volunteer.entity.Address;
import com.sunday.volunteer.entity.Cart;
import com.sunday.volunteer.entity.GroupType;
import com.sunday.volunteer.entity.Images;
import com.sunday.volunteer.entity.Member;
import com.sunday.volunteer.entity.Order;
import com.sunday.volunteer.entity.Product;

import java.util.List;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;

/**
 * Created by Administrator on 2016/3/4.
 */
public interface HttpService {


    /**
     * 上传单张图片
     *
     * @param body
     * @return
     */
    @Multipart
    @POST("/volunteer/mobile/upload/uploadSingleFile")
    Call<ResultDO<Images>> uploadSingleFile(@Part("file") RequestBody body);


    /**
     * 上传多张图片
     *
     * @param body
     * @return
     */
    @Multipart
    @POST("/volunteer/mobile/upload/uploadMultiFile")
    Call<ResultDO<List<Images>>> uploadMultiFile(@Part("files") RequestBody body);


    /**
     * 发送验证码
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/code/send")
    Call<ResultDO> sendCode(@Field("mobile") String mobile);


    /**
     * 验证验证码
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/code/check")
    Call<ResultDO> checkCode(@Field("mobile") String mobile ,@Field("validateCode")  String validateCode);






    /**
     * 用户注册
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/register")
    Call<ResultDO<Member>> register(@Field("mobile") String mobile,
                                    @Field("password") String password,
                                    @Field("name") String name,
                                    @Field("idCard") String idCard,
                                    @Field("idCardFront") String idCardFront,
                                    @Field("idCardBack") String idCardBack,
                                    @Field("code") String code
    );


    /**
     * 用户登录
     *
     * @param mobile
     * @param password
     * @param loginType
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/login")
    Call<ResultDO<Member>> login(@Field("mobile") String mobile,
                                 @Field("password") String password,
                                 @Field("loginType") int loginType);



    /**
     * 忘记密码
     *
     * @param mobile
     * @param newPassword
     * @param validateCode
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/forgetPassword")
    Call<ResultDO> forgetPassword(@Field("mobile") String mobile,
                                 @Field("newPassword") String newPassword,
                                 @Field("validateCode") String validateCode);


    /**
     * 修改密码
     * @param memberId
     * @param validateCode
     * @param oldPassword
     * @param newPassword
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/updatePassword")
    Call<ResultDO> updatePassword(@Field("memberId") long memberId,
                                 @Field("validateCode") String validateCode,
                                 @Field("oldPassword") String oldPassword,
                                 @Field("newPassword") String newPassword );



    /**
     * 获取用户信息
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/getMemberDeatail")
    Call<ResultDO<Member>> getMemberDeatail(@Field("memberId") long memberId);


    /**
     * 修改用户资料
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/updateMember")
    Call<ResultDO<Member>> updateMember(@Field("memberId") long memberId, @Field("name") String name, @Field("logo") String logo);


    /**
     * 获取首页轮播图
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/news/getNews")
    Call<ResultDO<List<Images>>> getNews(@Field("type") String type);


    /**
     * 获取活动列表
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/activity/getActivitys")
    Call<ResultDO<List<Activity>>> getActivitys(@Field("memberId") long memberId,
                                                @Field("page") int page,
                                                @Field("rows") int rows,
                                                @Field("sortField") String sortField,
                                                @Field("sortOrder") String sortOrder,
                                                @Field("groupName") String groupName

    );


    /**
     * 获取我参加的的活动
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/activity/getMyActivitys")
    Call<ResultDO<List<Activity>>> getMyActivitys(@Field("memberId") long memberId, @Field("page") int page, @Field("rows") int rows, @Field("status") int status, @Field("groupName") String groupName);


    /**
     * 获取活动详情
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/activity/getActivityDetail")
    Call<ResultDO<Activity>> getActivityDetail(@Field("memberId") long memberId, @Field("activityId") long activityId);


    /**
     * 获取商品列表
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/product/selectScoreProduct")
    Call<ResultDO<List<Product>>> selectScoreProduct(@Field("memberId") long memberId, @Field("page") int page, @Field("rows") int rows);


    /**
     * 获取商品详情
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/product/findOne")
    Call<ResultDO<Product>> findOne(@Field("productId") long productId);


    /**
     * 确认订单
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/order/countBuyNow")
    Call<ResultDO<Cart>> countBuyNow(@Field("memberId") long memberId, @Field("productId") long productId, @Field("number") int number);


    /**
     * 生成订单
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/order/createOrder")
    Call<ResultDO<Order>> createOrder(@Field("memberId") long memberId, @Field("cartIds") String cartIds, @Field("addressId") long addressId);


    /**
     * 创建活动
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/activity/createActivity")
    Call<ResultDO> createActivity(@Field("memberId") long memberId,
                                  @Field("name") String name,
                                  @Field("limitNumber") int limitNumber,
                                  @Field("startTime") String startTime,
                                  @Field("endTime") String endTime,
                                  @Field("address") String address,
                                  @Field("mainImage") String mainImage,
                                  @Field("rollImages") String rollImages,
                                  @Field("isPrivate") int isPrivate,
                                  @Field("desc") String desc
    );


    /**
     * 获取组织分类
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/dictionary/select")
    Call<ResultDO<List<GroupType>>> select(@Field("type") String type);

    /**
     * 获取组织列表
     *
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/group/getGruops")
    Call<ResultDO<List<Member>>> getGruops(@Field("memberId") Long memberId, @Field("page") int page, @Field("rows") int rows, @Field("groupType") String groupType, @Field("name") String name);


    /**
     * 申请加入组织
     *
     * @param memberId
     * @param groupId
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/group/join")
    Call<ResultDO> join(@Field("memberId") Long memberId, @Field("groupId") Long groupId);


    /**
     * 活动报名
     *
     * @param memberId
     * @param activityId
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/activity/baoming")
    Call<ResultDO> baoming(@Field("memberId") Long memberId, @Field("activityId") Long activityId);

    /**
     * 活动取消报名
     *
     * @param memberId
     * @param activityId
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/activity/quxiaobaoming")
    Call<ResultDO> quxiaobaoming(@Field("memberId") Long memberId, @Field("activityId") Long activityId);


    /**
     * 新增或修改地址
     *
     * @param memberId
     * @param receiveName
     * @param mobile
     * @param address
     * @param addressId
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/address/save")
    Call<ResultDO> save(@Field("memberId") Long memberId,
                        @Field("receiveName") String receiveName,
                        @Field("mobile") String mobile,
                        @Field("address") String address,
                        @Field("addressId") Long addressId);


    /**
     * 删除地址
     *
     * @param addressId
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/address/delete")
    Call<ResultDO> delete(@Field("addressId") Long addressId);


    /**
     * 地址列表
     *
     * @param memberId
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/address/list")
    Call<ResultDO<List<Address>>> list(@Field("memberId") Long memberId);




    /**
     * 订单列表
     * @param memberId
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/order/getOrders")
    Call<ResultDO<List<Order>>> getOrders(@Field("memberId") Long memberId ,
                                       @Field("orderStatus") int orderStatus ,
                                       @Field("page") int page ,
                                       @Field("rows") int rows
                                       );

    /**
     * 活动签到或签退
     * @param memberId
     * @param activityId
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/activity/sign")
    Call<ResultDO> sign(@Field("memberId") Long memberId , @Field("activityId") String activityId );


    /**
     * 获取排名
     * @param type
     * @return
     */
    @FormUrlEncoded
    @POST("/volunteer/mobile/member/getBang")
    Call<ResultDO<List<Member>>> getRaking(@Field("type") int type);






}
